package cn.shyouchi.wuguanjia.android.ui.meetting.plan;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.Global;
import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.widget.GlideCircleTransform;

/**
 * Created by Eenie on 2017/2/9 at 16:20
 * Email: 472279981@qq.com
 * Des:
 */

public class PlanMeetAdapter extends BaseQuickAdapter<PlanMeetEntity, BaseViewHolder> {
    public PlanMeetAdapter(List<PlanMeetEntity> data) {
        super(R.layout.item_plan_meet_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder holder, final PlanMeetEntity entity) {











        holder.setText(R.id.tv_person_name, entity.getUsername());
        holder.setText(R.id.tv_meet_name, String.format("%s",  entity.getName()));
        holder.setText(R.id.tv_apply_res, entity.getState());
        holder.setText(R.id.tv_apply_time, entity.getStart());
        loadHead(Global.BASE_URL + entity.getId_card_head_image(), (ImageView) holder.getView(R.id.img_header));

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(mContext, PlanMeetDetailActivity.class);
                intent.putExtra("meetId", entity.getId());
                mContext.startActivity(intent);
            }
        });


    }


    private void loadHead(String path, ImageView imageView) {
        Glide.with(mContext)
                .load(path)
                .transform(new GlideCircleTransform(mContext))
                .into(imageView);
    }
}
